#include <QtGui/QApplication>
#include <QFileInfo>
#include <QSettings>
#include "MainWindow.h"

int main(int argc, char *argv[])
{
    Q_INIT_RESOURCE(Main);
    Q_INIT_RESOURCE(About);
    Q_INIT_RESOURCE(Settings);
    Q_INIT_RESOURCE(i18n);

    QSettings::setDefaultFormat(QSettings::IniFormat);

    QApplication app(argc, argv);
    app.setOrganizationName("SolidPak");
    app.setOrganizationDomain("solidpak.org");
    app.setApplicationName("CodePad");
    app.setApplicationVersion("0.5");

    MainWindow mainWindow;
    mainWindow.show();
    // command line support
    if (app.arguments().count() == 2 && QFileInfo(app.arguments().at(1)).exists()) {
        mainWindow.openFile(app.arguments().at(1));
    }

    return app.exec();
}
